from openpyxl import load_workbook
class excel():
    def __init__(self, excelpath, sheetname):
        self.excelpath=load_workbook(excelpath)
        self.sheetname=self.excelpath[sheetname]

    def getdatasfromexcel(self):
        datalist=[]
        for line in self.sheetname:
            t_list=[]
            t_list.append(line[0].value)
            t_list.append(line[1].value)
            t_list.append(line[2].value)
            t_list.append(line[3].value)
            datalist.append(t_list)
        datalist.pop(0)
        return datalist


if __name__ == '__main__':
    excelpath=r'D:\zhuangao5\unit_17\Data\data.xlsx'
    sheetname='Sheet1'
    dy=excel(excelpath, sheetname)
    print(dy.getdatasfromexcel())
